package com.agent.common.result;

import lombok.Getter;

/**
 * 统一返回状态码枚举
 * @author Jeff_Wan
 * @description 定义系统所有业务状态码
 */
@Getter
public enum ResultCode {
    NORMAL_ERR(-1, "Operation Failure"),
    SUCCESS(200, "Success"),
    BAD_REQUEST(400, "Bad Request"),
    UNAUTHORIZED(401, "Unauthorized"),
    FORBIDDEN(403, "Forbidden"),
    NOT_FOUND(404, "Not Found"),
    METHOD_NOT_ALLOWED(405, "Method Not Allowed"),
    INTERNAL_SERVER_ERROR(500, "Internal Server Error"),
    SYSTEM_CRASH(999, "Server busy, please try again later"),

    // 业务相关错误码
    USER_NOT_EXIST(1001, "User not exist"),
    USER_NOT_LOGIN(1002, "User not login"),
    INVALID_CREDENTIALS(1003, "Invalid credentials"),
    INSUFFICIENT_CREDITS(1004, "Insufficient credits"),
    MEMBERSHIP_EXPIRED(1005, "Membership expired"),
    TASK_NOT_FOUND(1006, "Task not found"),
    ASSET_NOT_FOUND(1007, "Asset not found"),
    INVALID_PAYMENT(1008, "Invalid payment"),
    MODEL_NOT_SUPPORTED(1009, "Model not supported"),
    FILE_UPLOAD_FAILED(1010, "File upload failed"),
    INVALID_PARAMETERS(1011, "Invalid parameters"),
    MEMBERSHIP_UPGRADE_FAILED(1012, "Membership upgrade failed"),
    MEMBERSHIP_DOWNGRADE_NOT_ALLOWED(1013, "Membership downgrade not allowed"),
    CREDIT_CALCULATION_ERROR(1014, "Credit calculation error"),
    TASK_PROCESSING_FAILED(1015, "Task processing failed"),
    ASSET_DOWNLOAD_FORBIDDEN(1016, "Asset download forbidden for free user"),
    API_LIMIT_EXCEEDED(1017, "API limit exceeded"),
    INVALID_SUBSCRIPTION_PLAN(1018, "Invalid subscription plan"),
    PAYMENT_GATEWAY_ERROR(1019, "Payment gateway error"),
    MEMBERSHIP_ACTIVE_SUBSCRIPTION(1020, "Active subscription exists"),

    // 后台管理相关错误码
    ADMIN_USER_NOT_EXIST(2001, "Admin user not exist"),
    ADMIN_USER_DISABLED(2002, "Admin account disabled"),
    ADMIN_INVALID_CREDENTIALS(2003, "Invalid admin credentials"),
    ADMIN_PERMISSION_DENIED(2004, "Permission denied"),
    ADMIN_OPERATION_LOG_FAILED(2005, "Operation log failed"),
    ADMIN_ACCOUNT_LOCKED(2006, "Admin account temporarily locked"),
    ADMIN_USER_ALREADY_EXISTS(2007, "Admin user already exists")

    ;

    private final int code;
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}